﻿namespace MicroCloud.Systems
{
    /// <summary>
    /// 业务契约：文件服务
    /// </summary>
    public interface IFileService
    {
        /// <summary>
        /// 获取映射到静态资源的相对请求路径
        /// </summary>
        /// <returns></returns>
        string GetRequestPath();

        /// <summary>
        /// 获取文件
        /// </summary>
        /// <returns></returns>
        /// <param name="id"></param>
        Task<FileOutputDto> GetFileInfo(string id);

        /// <summary>
        /// 获取文件
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        Task<FileOutputDto> GetFileInfoByName(string fileName);

        /// <summary>
        /// 上传文件
        /// </summary>
        /// <param name="dto">上传文件DTO</param>
        /// <returns></returns>
        Task<OperationResult<FileOutputDto>> UploadAsync(UploadInputDto dto);

        /// <summary>
        /// 下载文件
        /// </summary>
        /// <param name="id">文件编号</param>
        /// <returns></returns>
        Task<OperationResult<DownloadOutputDto>> DownloadAsync(string id);

        /// <summary>
        /// 更新文件
        /// </summary>
        /// <param name="dto">更新文件DTO</param>
        /// <returns></returns>
        Task<OperationResult<FileOutputDto>> UpdateAsync(UploadInputDto dto);

        /// <summary>
        /// 删除文件
        /// </summary>
        /// <param name="id">文件编号</param>
        /// <returns></returns>
        Task<OperationResult> DeleteAsync(string id);       
    }
}
